package org.jing.core.thread;

import org.jing.core.lang.BaseInitializer;
import org.jing.core.logger.JingLogger;
import org.jing.core.util.GenericUtil;

import java.util.List;

/**
 * Description: <br>
 *
 * @author bks <br>
 * @since 2023-09-19 <br>
 */
public class ThreadInitializer extends BaseInitializer<ThreadConfiguration> {
    private static final JingLogger LOGGER = JingLogger.getLogger(ThreadInitializer.class);

    @Override public void execute() {
        ThreadConfiguration config = getConfig();
        ThreadFactory.setLimitCount(config.getLimitCount());
        List<ThreadSubConfiguration> subConfigs = config.getSubThread();
        ThreadSubConfiguration subConfig;
        for (int i$ = 0, l$ = GenericUtil.count(subConfigs); i$ < l$; i$ ++) {
            subConfig = subConfigs.get(i$);
            ThreadFactory.create(subConfig.getThreadImpl(), subConfig.getConfigC(), subConfig.canWait());
        }
    }
}
